home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 4 / MacMania 4.toast / / Demo's / Igor Demo Pro / 1 PutContentsIn Igor Pro Folder / WaveMetrics Procedures / Data Manipulation / Multi-dimensional Utilities < prev    next >
Text File  |  1996-01-29  |  1KB  |  37 lines

  1. | Multi-dimensional Utilities
  2. | utilities for dealing with multi-dimensional waves (matrices and the like)
  3.  
  4. // Multi-dimensional x2pnt
  5. // returns row, column, layer, or chunk index nearest the x,y,z, or t scaling value
  6. Function x2pntMD(w,dim,xyzt)    // xyzt is x val if dim==0, y if dim==1, z if dim==2, t if dim==3
  7.     Wave w
  8.     Variable/D dim,xyzt
  9.     return round( (xyzt - DimOffset(w, dim))/DimDelta(w,dim) )
  10. End
  11.  
  12. // Multi-dimensional pnt2x
  13. // returns x,y,z, or t scaling value for the given row, column, layer, or chunk index  
  14. Function pnt2xMD(w,dim,pqrs)    // pqrs is p val if dim==0, q if dim==1, r if dim==2, s if dim==3
  15.     Wave w
  16.     Variable/D dim,pqrs 
  17.     return DimOffset(w, dim) + pqrs*DimDelta(w,dim)
  18. End
  19.  
  20. // Multi-dimensional rightx
  21. // returns x,y,z, or t scaling value for the row, column, layer, or chunk after the last one in the wave 
  22. // for a one-dimensonal wave, rightxMD(w,0) is the same as rightx(w)
  23. Function rightxMD(w,dim)
  24.     Wave w
  25.     Variable/D dim
  26.     return DimOffset(w, dim) + DimSize(w,dim)*DimDelta(w,dim)
  27. End
  28.  
  29. // Multi-dimensional lastx
  30. // returns x,y,z, or t scaling value for the last row, column, layer, or chunk in the wave 
  31. // for a one-dimensonal wave, lastxMD(w,0) is the same as rightx(w)-deltax(w)
  32. Function lastxMD(w,dim)
  33.     Wave w
  34.     Variable/D dim
  35.     return DimOffset(w, dim) + (DimSize(w,dim)-1)*DimDelta(w,dim)
  36. End
  37.